package simul;

import util.ArmsLaw;
import util.Dice;
import util.file.FileParserException;
import data.obj.CombatResult;

public class Combat
{

	public Character c1;
	public Character c2;

	public Combat(Character c1, Character c2)
	{
		super();
		this.c1 = c1;
		this.c2 = c2;
	}

	public void process() throws FileParserException
	{
		ArmsLaw armsLaw = new ArmsLaw();
		boolean finishCombat=true;
		int turn=0;
		do
        {
			c1.calculateAcutalDB();
			c2.calculateAcutalDB();
			int c1Roll=(int) (Dice.D100OpenHand()+c1.actualOB-c2.acutalDB);
			int c2Roll=(int) (Dice.D100OpenHand()+c2.actualOB-c1.acutalDB);

			CombatResult c1Res= armsLaw.battleResult("Broadsword", c1Roll, 1);
			CombatResult c2Res= armsLaw.battleResult("Broadsword", c2Roll, 1);
			System.out.println("Turn: 0" +turn+"\tC1 "+c1Roll+" -->" +c1Res+"\tC2 "+c2Roll+" -->" +c2Res);

			c1.calculateResultCombat(c1Res);
			c2.calculateResultCombat(c2Res);
			
			turn++;
			
	        
        } while (turn<100 );
	}

	public static void main(String[] args) throws FileParserException
    {
	    Character c1 = new Character(.5, 50, 50, 100, 100, 1, 1);
	    Character c2 = new Character(.5, 50, 50, 100, 100, 1, 1);
	    Combat Combat = new Combat(c1, c2);
	    Combat.process();
    }
}
